import { Button, Table } from 'antd';
import { useState } from 'react';
import { Select, Space } from 'antd';
const handleChange = (value) => {
    console.log(`selected ${value}`);
  };
const columns = [
  {
    title: '口味必选',
    dataIndex: 'name',
  },
  {
    title: '免费配选畅饮/杯',
    dataIndex: 'age',
    render() {
        return (
             <>
              <Select
      defaultValue="lucy"
      style={{
        width: 120,
      }}
      onChange={handleChange}
      options={[
        {
          value: 'jack',
          label: '果橙汁',
        },
        {
          value: 'lucy',
          label: '农夫山泉',
        },
        {
          value: 'Yiminghe',
          label: '怡宝',
        },
        {
          value: 'disabled',
          label: '可口可乐',
        //   disabled: true,
        },
      ]}
    />
             </>
        );
    }
  },
  {
    title: '价格',
    dataIndex: 'address',
  },
  {
    title: '份数',
    dataIndex: 'address',
    render(){
        return(
            <div>
            <div className='add'>
                +
            </div>
            1
            <div className='sub'>
                -
            </div>
            </div>
        )
    }
  },
  {
    title: '操作',
    dataIndex: 'address',
  },
];
const data = [];
for (let i = 0; i < 46; i++) {
  data.push({
    key: i,
    name: `Edward King ${i}`,
    age: 32,
    address: `London, Park Lane no. ${i}`,
  });
}
const ShopList = () => {
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
  const [loading, setLoading] = useState(false);
  const start = () => {
    setLoading(true);
    // ajax request after empty completing
    setTimeout(() => {
      setSelectedRowKeys([]);
      setLoading(false);
    }, 1000);
  };
  const onSelectChange = (newSelectedRowKeys) => {
    console.log('selectedRowKeys changed: ', newSelectedRowKeys);
    setSelectedRowKeys(newSelectedRowKeys);
  };
  const rowSelection = {
    selectedRowKeys,
    onChange: onSelectChange,
  };
  const hasSelected = selectedRowKeys.length > 0;
  return (
    <div>
      
      <Table rowSelection={rowSelection} columns={columns} dataSource={data} />
    </div>
  );
};
export default ShopList;